package dto.app;

import models.application.AniApp;
import models.application.AniAppClassification;
import models.pubobj.AniObjectType;
import models.pubobj.AniObjectState;
import models.user.AniUser;

/**
 * User: yeh
 * Date: 1/29/13
 * Time: 6:05 PM
 * For:  wilddragon
 */
public class PrivateAppInfoDto extends AppInfoDto{

    public Long id;

    public AniApp relyOn;

    public AniAppClassification appClassification;

    public String token;

    public AniObjectType type;

    public AniObjectState state;

    public String appName;

    public String description;

    public byte[] icon;

    public PrivateAppInfoDto(AniApp oneApp, AniUser oneUser, Long id, AniApp relyOn, AniAppClassification appClassification, String token, AniObjectType type, AniObjectState state, String appName, String description, byte[] icon, Boolean isInstalled) {
        super(
                oneApp,
                oneUser,
                isInstalled
        );
        this.id = id;
        this.relyOn = relyOn;
        this.appClassification = appClassification;
        this.token = token;
        this.type = type;
        this.state = state;
        this.appName = appName;
        this.description = description;
        this.icon = icon;
    }
    public static PrivateAppInfoDto generateFromDao(AniApp oneApp, AniUser curUser, Boolean isInstalled){
        return new PrivateAppInfoDto(
                oneApp,
                curUser,
                oneApp.id,
                oneApp.relyOn,
                oneApp.appClassification,
                oneApp.token,
                oneApp.type,
                oneApp.state,
                oneApp.appName,
                oneApp.description,
                oneApp.icon,
                isInstalled
        );
    }
}
